package work02.w5.control.server;

import java.util.HashMap;
import java.util.Map;

public class MyEventFactory {
	private static MyEventFactory me;
	public static MyEventFactory getNewInstance(){
		if(me==null)
			me=new MyEventFactory();
		return me;
	}
	private MyEventFactory(){}
	public MyEvent produceEvent(Object source, MyEventType eventType, Map<String, Object> params){
		if(source==null||eventType==null)
			throw new  IllegalArgumentException();
		return new MyEvent(source, eventType, params);
	}
	public MyEvent produceEvent(Object source, MyEventType eventType, String key,Object value){
		Map m=new HashMap<String, Object>(1);
		m.put(key, value);
		return produceEvent( source,eventType,m); 
	}
}
